package site.qianli.discover.service;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import site.qianli.discover.common.util.UUIDUtils;
import site.qianli.discover.common.vo.Article;
import site.qianli.discover.dao.ArticleMapper;

@Component
public class ArticleService {
	@Autowired
	private ArticleMapper articleMapper;

	int insert(Article article) {
		if (StringUtils.isEmpty(article.getId())) {
			article.setId(UUIDUtils.getID32());
		}
		return articleMapper.insert(article);
	}
}
